package top.xia17.plugins.fast.user.password;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 密码生成器配置
 *
 * @author xia17
 * @date 2022/2/21
 */
@Configuration
@RequiredArgsConstructor
public class PasswordGeneratorConfiguration {

    private final PasswordGeneratorProperties passwordGeneratorProperties;

    /**
     * 固定的密码生成器
     *
     * @return /
     */
    @Bean("stablePasswordGenerate")
    public PasswordGenerator stablePasswordGenerate() {
        return new StablePasswordGenerator();
    }

    /**
     * 手动输入的密码生成器
     *
     * @return /
     */
    @Bean("inputPasswordGenerator")
    public PasswordGenerator inputPasswordGenerator() {
        return new InputPasswordGenerator();
    }

    /**
     * 密码生成器管理类
     *
     * @return /
     */
    @Bean
    public PasswordGeneratorManager passwordGeneratorManager() {
        return new PasswordGeneratorManager(passwordGeneratorProperties);
    }

}
